﻿<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:helpers="clr-namespace:TrackMe.View.Helpers" xmlns:View="clr-namespace:TrackMe.View" xmlns:VM="clr-namespace:TrackMe.Apps.VM;assembly=TrackMe.Apps" xmlns:Dto="clr-namespace:TrackMe.Dto;assembly=TrackMe.Dto" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    x:Class="TrackMe.View.App" 
    ShutdownMode="OnExplicitShutdown"
    DispatcherUnhandledException="AppDispatcherUnhandledException"
    >
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Themes/NuclearBlue.xaml"/>
            </ResourceDictionary.MergedDictionaries>

        <DropShadowEffect x:Key="DescribingText" BlurRadius="1" ShadowDepth="1" Opacity="0.775" Color="#FFE9E9E9"/>
    	<Style x:Key="GridHeader" TargetType="{x:Type TextBlock}">
    		<Setter Property="FontWeight" Value="SemiBold"/>
    		<Setter Property="TextAlignment" Value="Center"/>
    		<Setter Property="Foreground" Value="White"/>
    		<Setter Property="Background" Value="#FF35547F"/>
    		<Setter Property="Height" Value="18"/>
    	</Style>

    	<helpers:TriggerConverter x:Key="TriggerConverter" />
    	<SolidColorBrush x:Key="ListBackground" Color="#FF293955"/>
        
    	<DataTemplate x:Key="TaskShortTemplate" DataType="{x:Type VM:ITaskForSelectVM}">
    		<Grid Height="58">
    			<Grid.RowDefinitions> 
    				<RowDefinition Height="0.4*"/>
    				<RowDefinition Height="0.6*"/>
    			</Grid.RowDefinitions>
    			<Grid.ColumnDefinitions>
    				<ColumnDefinition Width="26"/>
    				<ColumnDefinition Width="100*"/>
    				<ColumnDefinition Width="30"/>
    			</Grid.ColumnDefinitions>
    			<Image Grid.Column="0" Grid.RowSpan="2" Source="images\signpost.png" Width="24" Margin="0,0,0,16"/>
    			<TextBlock x:Name="projectName" 
    				Text="{Binding Model.ProjectName}" 
    				VerticalAlignment="Top" 
    				FontSize="17" 
    				Grid.Column="1" 
    				FontFamily="Arial Narrow" 
    				Foreground="#7F000000"/>
    			<TextBlock x:Name="taskName" 
    				TextWrapping="Wrap" 
    				Text="{Binding Model.TaskName}" 
    				FontSize="13" 
    				Grid.Column="1" 
    				Grid.Row="1"
    				FontFamily="Calibri" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"/>
    			<TextBlock x:Name="taskId" 
    				Text="{Binding Model.TaskId}"
    				Grid.Column="2" 
    				FontFamily="Arial Narrow" 
    				VerticalAlignment="Center" 
    				FontSize="10.667"
				    />
    			<Button Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" CommandParameter="{Binding Model}" Width="20">
    				<Button.Command>
    					<MultiBinding Converter="{StaticResource TriggerConverter}">
    						<Binding Path="SelectCmd"/>
    					</MultiBinding>
    				</Button.Command>
    				<Path Fill="Black" Data="M 0 0 L 6 6 L 0 12 Z"/>
    			</Button>
    		</Grid>
    	</DataTemplate>
    	<Style x:Key="TaskListBox" TargetType="{x:Type ListBox}">
    		<Setter Property="Background" Value="#293955"/>
    		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    		<Setter Property="ItemTemplate" Value="{Binding Source={StaticResource TaskShortTemplate}}"/>
            
    	</Style>

    	<DataTemplate x:Key="ProjectForList" DataType="{x:Type Dto:IProjectForList}">
    		<WrapPanel>
    			<TextBlock Text="{Binding Name}"/>
    		</WrapPanel>
    	</DataTemplate>

    	<DataTemplate x:Key="TaskForList" DataType="{x:Type Dto:ITaskForList}">
    		<WrapPanel>
    			<TextBlock Text="{Binding Name}"/>
    		</WrapPanel>
    	</DataTemplate>
    	<ImageBrush x:Key="IcoBackground" ImageSource="images/clock_256.png" Stretch="Fill"/>

    	<Style x:Key="KeyboardTooltip" />

    	<Style x:Key="RoundButton" TargetType="{x:Type Button}">
    		<Setter Property="SnapsToDevicePixels" Value="True"/>
    		<Setter Property="OverridesDefaultStyle" Value="True"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type Button}">
    					<Grid>
                        <!-- Background Layer -->
    						<Ellipse Fill="{TemplateBinding Background}"/>
                            <!-- Refraction Layer -->
    						<Ellipse x:Name="RefractionLayer">
    							<Ellipse.Fill>
    								<RadialGradientBrush GradientOrigin="0.496,1.052">
    									<RadialGradientBrush.RelativeTransform>
    										<TransformGroup>
    											<ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.5" ScaleY="1.5"/>
    											<TranslateTransform X="0.02" Y="0.3"/>
    										</TransformGroup>
    									</RadialGradientBrush.RelativeTransform>
    									<GradientStop Offset="1" Color="#00000000"/>
    									<GradientStop Offset="0.4" Color="#FFFFFFFF"/>
    								</RadialGradientBrush>
    							</Ellipse.Fill>
    						</Ellipse>
                                                    <!-- Reflection Layer -->
    						<Path x:Name="ReflectionLayer" VerticalAlignment="Top" Stretch="Fill">
    							<Path.RenderTransform>
    								<ScaleTransform ScaleY="0.5" />
    							</Path.RenderTransform>
    							<Path.Data>
    								<PathGeometry>
    									<PathFigure IsClosed="True" StartPoint="98.999,45.499">
    										<BezierSegment Point1="98.999,54.170" Point2="89.046,52.258" Point3="85.502,51.029"/>
    										<BezierSegment
    											IsSmoothJoin="True"
    											Point1="75.860,47.685"
    											Point2="69.111,45.196"
    											Point3="50.167,45.196"/>
    										<BezierSegment Point1="30.805,45.196" Point2="20.173,47.741" Point3="10.665,51.363"/>
    										<BezierSegment
    											IsSmoothJoin="True"
    											Point1="7.469,52.580"
    											Point2="1.000,53.252"
    											Point3="1.000,44.999"/>
    										<BezierSegment Point1="1.000,39.510" Point2="0.884,39.227" Point3="2.519,34.286"/>
    										<BezierSegment
    											IsSmoothJoin="True"
    											Point1="9.106,14.370"
    											Point2="27.875,0"
    											Point3="50,0"/>
    										<BezierSegment Point1="72.198,0" Point2="91.018,14.466" Point3="97.546,34.485"/>
    										<BezierSegment
    											IsSmoothJoin="True"
    											Point1="99.139,39.369"
    											Point2="98.999,40.084"
    											Point3="98.999,45.499"/>
    									</PathFigure>
    								</PathGeometry>
    							</Path.Data>
    							<Path.Fill>
    								<RadialGradientBrush GradientOrigin="0.498,0.526">
    									<RadialGradientBrush.RelativeTransform>
    										<TransformGroup>
    											<ScaleTransform
    												CenterX="0.5"
    												CenterY="0.5"
    												ScaleX="1"
    												ScaleY="1.997"/>
    											<TranslateTransform X="0" Y="0.5"/>
    										</TransformGroup>
    									</RadialGradientBrush.RelativeTransform>
    									<GradientStop Offset="1" Color="#FFFFFFFF"/>
    									<GradientStop Offset="0.85" Color="#92FFFFFF"/>
    									<GradientStop Offset="0" Color="#00000000"/>
    								</RadialGradientBrush>
    							</Path.Fill>
    						</Path>
                                                                                            <!-- ContentPresenter -->
    						<ContentPresenter Margin="0,2,0,0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    					</Grid>


    					<ControlTemplate.Triggers>
    						<Trigger Property="IsMouseOver" Value="True">
    							<Setter TargetName="RefractionLayer" Property="Fill">
    								<Setter.Value>
    									<RadialGradientBrush GradientOrigin="0.496,1.052">
    										<RadialGradientBrush.RelativeTransform>
    											<TransformGroup>
    												<ScaleTransform
    													CenterX="0.5"
    													CenterY="0.5"
    													ScaleX="1.5"
    													ScaleY="1.5"/>
    												<TranslateTransform X="0.02" Y="0.3"/>
    											</TransformGroup>
    										</RadialGradientBrush.RelativeTransform>
    										<GradientStop Offset="1" Color="#00000000"/>
    										<GradientStop Offset="0.45" Color="#FFFFFFFF"/>
    									</RadialGradientBrush>
    								</Setter.Value>
    							</Setter>
    							<Setter TargetName="ReflectionLayer" Property="Fill">
    								<Setter.Value>
    									<RadialGradientBrush GradientOrigin="0.498,0.526">
    										<RadialGradientBrush.RelativeTransform>
    											<TransformGroup>
    												<ScaleTransform
    													CenterX="0.5"
    													CenterY="0.5"
    													ScaleX="1"
    													ScaleY="1.997"/>
    												<TranslateTransform X="0" Y="0.5"/>
    											</TransformGroup>
    										</RadialGradientBrush.RelativeTransform>
    										<GradientStop Offset="1" Color="#FFFFFFFF"/>
    										<GradientStop Offset="0.85" Color="#BBFFFFFF"/>
    										<GradientStop Offset="0" Color="#00000000"/>
    									</RadialGradientBrush>
    								</Setter.Value>
    							</Setter>
    						</Trigger>
    						<Trigger Property="IsPressed" Value="True">
    							<Setter TargetName="RefractionLayer" Property="Fill">
    								<Setter.Value>
    									<RadialGradientBrush GradientOrigin="0.496,1.052">
    										<RadialGradientBrush.RelativeTransform>
    											<TransformGroup>
    												<ScaleTransform
    													CenterX="0.5"
    													CenterY="0.5"
    													ScaleX="1.5"
    													ScaleY="1.5"/>
    												<TranslateTransform X="0.02" Y="0.3"/>
    											</TransformGroup>
    										</RadialGradientBrush.RelativeTransform>
    										<GradientStop Offset="1" Color="#00000000"/>
    										<GradientStop Offset="0.3" Color="#FFFFFFFF"/>
    									</RadialGradientBrush>
    								</Setter.Value>
    							</Setter>
    							<Setter TargetName="ReflectionLayer" Property="Fill">
    								<Setter.Value>
    									<RadialGradientBrush GradientOrigin="0.498,0.526">
    										<RadialGradientBrush.RelativeTransform>
    											<TransformGroup>
    												<ScaleTransform
    													CenterX="0.5"
    													CenterY="0.5"
    													ScaleX="1"
    													ScaleY="1.997"/>
    												<TranslateTransform X="0" Y="0.5"/>
    											</TransformGroup>
    										</RadialGradientBrush.RelativeTransform>
    										<GradientStop Offset="1" Color="#CCFFFFFF"/>
    										<GradientStop Offset="0.85" Color="#66FFFFFF"/>
    										<GradientStop Offset="0" Color="#00000000"/>
    									</RadialGradientBrush>
    								</Setter.Value>
    							</Setter>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    <!-- ItemContainerStyle with the Trigger for Selected -->
    	<Style x:Key="SelectedTask" TargetType="{x:Type ListBoxItem}">
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="{x:Type ListBoxItem}">
    					<ControlTemplate.Resources>
    						<Storyboard x:Key="Storyboard1"/>
    					</ControlTemplate.Resources>
    					<Border x:Name="ItemBorder"
    						Margin="0,1" CornerRadius="6" Background="#FFFDFDFD">
    						<ContentPresenter SnapsToDevicePixels="True" />
    					</Border>
    					<ControlTemplate.Triggers>
    						<Trigger Property="IsSelected" Value="true">
    							<Trigger.EnterActions>
    								<BeginStoryboard Storyboard="{StaticResource Storyboard1}"/>
    							</Trigger.EnterActions>
    							<Setter Property="Background" TargetName="ItemBorder" Value="#FFD0E0ED"/>
    						</Trigger>
    					</ControlTemplate.Triggers>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
    	<View:TimeSpanConverter x:Key="TimeSpanConverter" />
    	<LinearGradientBrush x:Key="TextBoxBorder" EndPoint="0,20" MappingMode="Absolute" StartPoint="0,0">
    		<GradientStop Color="#ABADB3" Offset="0.05"/>
    		<GradientStop Color="#E2E3EA" Offset="0.07"/>
    		<GradientStop Color="#E3E9EF" Offset="1"/>
    	</LinearGradientBrush>
        </ResourceDictionary>
    </Application.Resources>
    
</Application>
